﻿@model IEnumerable<BlogElements.Models.Post>

@{
    ViewBag.Title = "Blog Elements - Home";
}

<div class="sidebar">
    <h3>Tags:</h3>
    @{Html.RenderAction("Tags", "Post");}
</div>
<div class="main-content">
    @foreach (var post in Model)
    {
        <div class="preview-item">
            <h3><a href="@Url.Action("Post", new { id = @post.PostId })">@post.Title</a></h3>
            <div class="post-date">@post.DateCreated.ToString()</div>
            <p>@post.Description</p>
            <div class="item-tags">Tags: 
            @foreach (var tag in post.PostTags)
            { 
                @Html.ActionLink(tag.Tag.Name, "Browse", "Post", new { Tag = tag.Tag.Name }, null)
            }
            </div>
        </div>
    }
</div>
